<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>积云健康</title>
    <meta name="description" content="积云健康">
    <meta name="keywords" content="积云健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <style type="text/css">
    .el-main{
        position: absolute;
        top: 70px;
        bottom: 0px;
        left: 200px;
        right: 10px;
        padding: 0;
    }
    </style>
    <script src="../js/axios-0.18.0.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/util.js"></script>
</head>
<body class="hold-transition skin-purple sidebar-mini">
    <div id="app">
        <el-container>
            <el-header  class="main-header" style="height:70px;">
                <nav class="navbar navbar-static-top" :class=''>
                    <!-- Logo -->
                    <a href="#" class="logo" style="text-align:center">
                        <span class="logo-lg"><img src="../img/logo.png"></span>
                    </a>
                    <div class="right-menu">
                        <span class="help"><i class="fa fa-exclamation-circle" aria-hidden="true"></i>帮助</span>
                        <el-dropdown class="avatar-container right-menu-item" trigger="click">
                            <div class="avatar-wrapper">
                                <img src="../img/user2-160x160.jpg" class="user-avatar">
                                Jay.Liu
                            </div>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item divided>
                                    <span style="display:block;">修改密码</span>
                                </el-dropdown-item>
                                <el-dropdown-item divided>
                                        <span style="display:block;">退出</span>
                                    </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                </nav>
            </el-header>
            <el-container>
                <el-aside width="200px">
                    <el-menu>
                        <el-submenu v-for="menu in menuList" :index="menu.path">
                            <template slot="title">
                                <i class="fa" :class="menu.icon"></i>
                                {{menu.title}}
                            </template>
                            <template v-for="child in menu.children">
                                <el-menu-item :index="child.path">
                                    <a :href="child.linkUrl" target="right">{{child.title}}</a>
                                </el-menu-item>
                            </template>
                        </el-submenu>
                    </el-menu>
                </el-aside>

                <el-container>

                    <table border="1" width="90%" >
                        <tr>
                            <td colspan="8">
                                <button type="button" @click="add()">添加</button>
                                <input type="text" v-model="input">
                                <button type="button" @click="qc(1)">搜索</button>
                                <button type="button" @click="dc()">导出</button>

                            </td>


                        </tr>
                        <tr>
                            <td>ID</td>
                            <td>编号</td>
                            <td>姓名</td>
                            <td>性别</td>
                            <td>身份证</td>
                            <td>手机号</td>
                            <td>邮箱</td>
                            <td>操作</td>
                        </tr>
                        <tr v-for="a in pojo">
                            <td>{{a.id}}</td>
                            <td>{{a.bh}}</td>
                            <td>{{a.name}}</td>
                            <td>{{a.sex}}</td>
                            <td>{{a.sfzh}}</td>
                            <td>{{a.sjh}}</td>
                            <td>{{a.yx}}@qq.com</td>
                            <td>
                                <button type="button" @click="hx(a.id)">修改</button>
                                <button type="button" @click="del(a.id)">删除</button>
                            </td>

                        </tr>
                    </table>
<!--                    <iframe name="right" class="el-main" src="member.html" width="100%" height="880px" frameborder="0"></iframe>-->
                </el-container>
            </el-container>
        </el-container>
    </div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data:{
            pojo:{},
            input:'',
            menuList:[
                {
                    "path": "2",
                    "title": "会员管理",
                    "icon":"fa-user-md",
                    "children": [
                        {
                            "path": "/2-1",
                            "title": "会员档案管理",
                            "linkUrl":"member.html",
                            "children":[]
                        }
                    ]
                },
                {
                    "path": "3",
                    "title": "预约管理",
                    "icon":"fa-tty",
                    "children": [
                        {
                            "path": "/3-1",
                            "title": "检查项管理",
                            "linkUrl":"checkitem.html",
                            "children":[]
                        },
                    ]
                }
            ]
        },
        methods:{
            qc(){
                axios.get("http://localhost:10010/user/qc?name="+this.input).then(
                    res=>{
                        this.pojo=res.data
                    }
                )
            },
            hx(id){
                location.href="update.html?id="+id
            },
            add(){
                location.href="add.html"
            },
            dc(){
                axios.get("http://localhost:10010/user/dc").then(
                    res=>{
                        alert("导出成功");
                        this.qc()
                    }
                )
            },
            del(id){
                axios.get("http://localhost:10010/user/del?id="+id).then(
                    res=>{
                      alert("删除成功");
                      this.qc()
                    }
                )
            }
        },
        created(){
            this.qc()
        }
    });
    $(function() {
            var wd = 400;
            $(".el-main").css('width', $('body').width() - wd + 'px');
    });
</script>
</html>
